﻿using Microsoft.Extensions.Configuration;

namespace Api.Shared.Sugar.Sqlite
{
    public class SqliteService : ISqlSugarService
    {
        //sqlserver
        //private string connectionStr = "server=.;uid=sa;pwd=sasa;database=SQLSUGAR4XTEST";
        //sqlite
        //private string connectionStr = "Data Source=MyDb.db";
        //mysql
        //private string connectionStr = "database='" + "mydb" + "';Data Source = '" + "127.0.0.1" + "'; User Id = '" + "root" + "'; pwd='" + "123456" + "';charset='utf8mb4';pooling=true";

        //private string connectionStr = "server=localhost;Port=3306;Database=mydb;Uid=root;Pwd=123456;Charset=utf8mb4;min pool size=1";
        //private string connectionStr = "server=localhost;Database=mydb;Uid=root;Pwd=123456;";

        //private string connectionStr = @"Data Source=C:\MyDb.db";
        private string? connectionStr;
        public SqliteService(IConfiguration configuration)
        {
            connectionStr = configuration.GetSection("databaseIp").Value;
        }

        public string ConnectionStr
        {
            get { return connectionStr ?? string.Empty; }
            set { connectionStr = value; }
        }
    }
}
